<?php get_header(); ?>
<?php get_template_part('left','menu');?>
<section>
<div class="container">
<div class="left_summary" id="left_side">
	<div class="showType">
	<?php wp_bac_breadcrumb();?>
	</div>
	<div class="content_out">
	<div class="content"  id="content">
		<div class="clear"></div>										
		<?php if( have_posts() ) : while( have_posts() ) : the_post();?>
		<div class="perContentBox " id="post-153007">
		<div class="contentBg">
		<div class="con_title">
		<span class="conName"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?><span class="red">&nbsp;&nbsp;&nbsp;<?php echo get_post_meta($post->ID,"_red_title",true);?></span></a></span>
		<div class="conTime"><?php the_time('m-d g:i');?></div>
		<div class="clear"></div>
		</div>
		<div class="showLeft">
			<div class="proRightBox">
				<div class="pro1">
					<div class="like">
						<div class="collect">
						<a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav"><?php echo get_post_fav_count($post->ID);?></a>
						</div>
						<div class="commentCount">
							<?php comments_popup_link( '0', '1', '%'); ?>
						</div>
						<div class="clear"></div>
					</div>
					<div  style="width:150px; height:150px; float:none; text-align:center; padding:5px;border:0px solid #ccc;overflow:hidden; display:table-cell;vertical-align:middle;">
                            <?php
                                if( has_post_thumbnail() ){
                                    echo get_the_post_thumbnail( $post->ID, array(150, 150), array('alt'=>$post->post_title) );
                                }else{
                                    echo '<img  style="max-width:150px;max-height:150px;"   src="'.get_post_img( '', 150, 150 ).'" alt="'.$post->post_title .'" />';
                                }
                            ?>
                        </div>
					<div class="zhida" id="buy_url_<?php echo $post->ID;?>">
		<a href="<?php echo home_url('/');?>go/<?php echo $post->ID?>" rel="nofollow" class="border_radius_3" target="_blank">直 达 链 接</a>

					<div style="display:none"></div>
					</div>
				</div>
				<div class="mall"><span class="grey">商城：</span><span class="from_val">
				<?php $terms = get_the_terms( $post->ID, 'mall' );
			if ( $terms && ! is_wp_error( $terms ) ) : 
				$draught_links = array();
				foreach ( $terms as $term ) {
					$draught_links[] = $term->name;
					}
				$on_draught = join( ", ", $draught_links );
				echo $on_draught;
			endif; ?>
				</span></div>
			</div>
			<div class="leftShowInfo">
			<span class="has_from_val classified">
					<span class="grey">分类：</span>
					 <?php the_category('，'); ?>
			</span>
				<span class="featured">推荐人：<?php if(get_post_meta($post->ID,'_post_author',true)){ echo get_post_meta($post->ID,'_post_author',true); }else{ the_author();} ?></span>				<div class="clear"></div>
			</div>
			<div class="conBox excerptBox" id="content_<?php echo $post->ID;?>">   
                  <div class="desc content_font"> 
                    <?php the_content();?>
                  </div>
                   <div class="pro1_con">
            <a onclick="return change_show_mode('showDetails', 'content_<?php echo $post->ID;?>');" href="" class="showDetails" style=""><div style="color:#1b8be0">展开全文</div></a>

            <a onclick="return change_show_mode('closeDetails', 'content_<?php echo $post->ID;?>');" href="" class="closeDetails" style="display: none; ">向上收起</a>
                  </div>
                </div>
		</div>
		<div class="clear"></div>
		<div class="Score">
              <div style="float:left; padding-top:10px">		
				<?php 
						$voteup = $post->vote_up; 
						$votedown = $post->vote_down;
						$voteall = $voteup + $votedown;
				?>
                    <span  style="float: left; padding:2px 0px 0 0;  width: 75px; background: url(<?php echo get_template_directory_uri();?>/images/like.png) 57px 5px no-repeat; color:#555;">评价本文</span>
                    
					<span class="vote_up"  id="vote_up<?php the_ID(); ?>"><a href="#" title="值得" rel="up_<?php the_ID(); ?>">
					<span  style="width:20px ; margin-left:10px" id="vup<?php the_ID(); ?>"><?php echo $voteup; ?></span></a>人认为值得买！</span>	
                    				
					<span class="vote_down" id="vote_down<?php the_ID(); ?>"><a href="#" title="不值" rel="down_<?php the_ID(); ?>">
                    <span style="width:20px ; margin-left:10px"   id="vdown<?php the_ID(); ?>"><?php echo $votedown; ?></span></a>人认为不值得买！</span>	
                    
                    <span class="allvotes"  id="allvotes<?php the_ID(); ?>">
                    <span id="va<?php the_ID(); ?>"> <?php echo $voteall; ?> </span> 位网友中的
                    <span style="color:#B30B09"  id="vup1<?php the_ID(); ?>"><?php echo $voteup; ?></span> 位认为值得买！
                    </span> 	                
        <script type="text/javascript">

				jQuery( document ).ready( function() {		
				// voting post
				var ue_token = 1;				
				jQuery( '#vote_up<?php the_ID(); ?> a' ).click( function() {		
					
					if(ue_token != 1) {
						alert("您的鼠标点得也太快了吧？！");
						return false;
					}
					ue_token = 0;
				
					var full_info = jQuery( this ).attr( 'rel' );
					var arr_param = full_info.split( '_' );						
					jQuery.post( "<?php echo get_bloginfo( 'template_url' ) ?>/include/vote.php", { act: arr_param[ 0 ], pid: arr_param[ 1 ] }, 
						function( data ) {
							if( data ) {
								var upd_vu = '#vup' + arr_param[ 1 ];
								jQuery( upd_vu ).text( data );
								ue_token = 1;
														
							 	var upd_vu = '#vup1' + arr_param[ 1 ];
								jQuery( upd_vu ).text( data );
								ue_token = 1;
		
								var upd_va = '#va' + arr_param[ 1 ];							
								jQuery( upd_va ).text(<?php echo $voteall+1 ?>);
								ue_token = 1;
								
							}else{
								alert("你已经表过态了！");
								ue_token = 1;
							}
						} );							
					return false;						
				} );	
					
					
				jQuery( '#vote_down<?php the_ID(); ?> a' ).click( function() {	
					
					if(ue_token != 1) {
						alert("您的鼠标点得也太快了吧？！");
						return false;
					}
					ue_token = 0;
								
					var full_info = jQuery( this ).attr( 'rel' );
					var arr_param = full_info.split( '_' );						
					jQuery.post( "<?php echo get_bloginfo( 'template_url' ) ?>/include/vote.php", { act: arr_param[ 0 ], pid: arr_param[ 1 ] }, 
						function( data ) {							
							if( data ) {
								var upd_vd = '#vdown' + arr_param[ 1 ];
								jQuery( upd_vd ).text( data );
								ue_token = 1;
																	
								var upd_va = '#va' + arr_param[ 1 ];;
								jQuery( upd_va ).text( data ) ;
															
								var upd_va = '#va' + arr_param[ 1 ];							
								jQuery( upd_va ).text(<?php echo $voteall+1 ?>);
								ue_token = 1;
													
							}else{		
								ue_token = 1;						
								alert("你已经表过态了！");
							}
						} );						
					return false;						
				} );	
			} );		
			</script>
			</div>
        
              <div style="float:right; padding-top:6px" > 
                <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
                <span style="cursor: pointer; display: block; float: left; height: 18px; color:#666; padding-top:6px; padding-left: 22px; vertical-align:middle ">分享到：</span>
                <a class="bds_tsina"></a>
                <a class="bds_tqq"></a>
                <a class="bds_renren"></a>
                <span class="bds_more"></span>
                </div>
            </div>
        </div>
	</div>
</div>
<?php endwhile; endif;?>
<div class="clear"></div>
</div>
<div class="pageBox">
<div class="page">
<?php pagenavi();?></div>
<div class="clear"></div>
</div>
</div>
</div>
<?php get_sidebar();?>
<div class="clear"></div>
</div>
</section>
<?php get_footer();?>